/*
 * 8.3.cpp 1543_poj
 *
 *  Created on: 2012-5-21
 *      Author: jawinton
 */

#include <iostream>
#include <cstring>
#include <cstdio>

#define SIZE 101

int cube[SIZE];

int main (void) {
	int n;
	scanf("%d", &n);
	for (int i=1; i<=n; i++)
		cube[i] = i*i*i;
	int a, b, c, d;
	for (a=6; a<=n; a++) {
		for (b=2; b<a-1; b++) {
			for (c=b+1; c<a; c++) {
				for (d=c+1; d<a; d++) {
					if (cube[a] == cube[b] + cube[c] + cube[d])
						printf("Cube = %d, Triple = (%d,%d,%d)\n", a, b, c, d);
				}
			}
		}
	}
	return 0;
}
